package com.store.controller;

import com.store.domain.R;
import com.store.domain.entity.User;
import com.store.service.UserService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author yu
 * @date 2024/6/26
 */
@RestController
@RequestMapping("admin")
public class AdminController {
    @Resource
    private UserService userService;
    @PostMapping("login")
    public R login(@RequestBody User user){
        user.setRoleId(1);
        return userService.login(user);
    }
    @PostMapping("logout")
    public R logout(){
        return userService.logout();
    }
}
